package com.taxi.controller;


import com.taxi.dto.DriverUserWorkStatus;
import com.taxi.dto.TokenResult;
import com.taxi.result.Result;
import com.taxi.service.IDriverUserWorkStatusService;
import com.taxi.util.JwtUtils;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author aniu
 * @since 2023-09-29
 */
@RestController
public class DriverUserWorkStatusController {

    @Autowired
    private IDriverUserWorkStatusService driverUserWorkStatusService;

    @ApiOperation("修改司机工作状态")
    @PostMapping("/driver-user-work-status")
    public Result changeWorkStatus(@RequestBody DriverUserWorkStatus driverUserWorkStatus){
        Long driverId = driverUserWorkStatus.getDriverId();
        Integer workStatus = driverUserWorkStatus.getWorkStatus();
        return driverUserWorkStatusService.changeWorkStatus(driverId,workStatus);
    }

    @GetMapping("/work-status/{driverId}")
    public Result<DriverUserWorkStatus> getWorkStatus(@PathVariable Long driverId){
        return driverUserWorkStatusService.getWorkStatus(driverId);
    }
}
